//
//  SubDevToDevUtil.m
//  AFNetworking
//
//  Created by Henry on 2023/7/20.
//

#import "SubDevToDevUtil.h"
#import "SubDeviceModel.h"
#import "DeviceModel.h"
@interface SubDevToDevUtil()
@end
@implementation SubDevToDevUtil

+(NSMutableArray *)getFromSubDev:(NSArray *)list{
    NSMutableArray *list2 = [[NSMutableArray alloc] init];
    if(list==nil){
        return list2;
    }else{
        [list enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            NSDictionary *dic= obj;
            SubDeviceModel *de = [[SubDeviceModel alloc] initWithDictionary:dic error:nil];
            DeviceModel *model = [[DeviceModel alloc] init];
            model.thingName = de.deviceCode;
            model.thingTypeName = de.thingTypeName;
            model.createTime = de.createTime;
            model.deviceName = de.deviceName;
            model.parentId = de.gatewayThing;
            model.softwareVersion = de.fwrev;
            model.firmwareVersion = de.hwrev;
            model.alarm = de.alarm;
            model.reportTime = de.reportTime;
            model.roomId = de.roomId;
            [list2 addObject:model];
        }];
        return list2;
    }
}

@end
